#include <functional> //reference_wrapper
#include <iostream>
#include <optional>
#include <string>
using namespace std;
optional<string> error(bool a) {
  if (a)
    return "True";
  else
    return {}; //?表达式无法直接返回{}
}
optional<string> error_opt(bool a) {
  return a ? std::optional<std::string>{"True"}
           : std::nullopt; // std::nullopt创建空的opt
}

auto error_ref(bool b) {
  static string value = "True";
  return b ? optional<reference_wrapper<string>>{value} : nullopt;
}
int main() {
  cout << error(true).value() << "\n";
  cout << error_opt(true).value() << "\n";
  cout << error_ref(true)->get() << "\n";
}
